package com.taoyuan.hotel.controller;

import com.taoyuan.hotel.entity.ItemType;
import com.taoyuan.hotel.service.intf.ItemTypeService;
import com.taoyuan.hotel.vo.PageBean;
import com.taoyuan.hotel.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/itemtype/")
public class ItemTypeController {
    @Autowired
    private ItemTypeService service;

    @PostMapping("save.do")
    public R save(ItemType itemType) {
        return service.save(itemType);
    }
    @GetMapping("page.do")
    public PageBean page(int page, int limit){
        return service.queryPage(page, limit);

    }
    //修改
    @PostMapping("update.do")
    public R update(ItemType itemType){
        return service.update(itemType);
    }
    //删除
    @PostMapping("del.do")
    public R del(int id){
        return service.del(id);
    }
    //查询 条件
    @GetMapping("pagewhere.do")
    public PageBean page(String type, int page,int limit){
        return service.queryPageWhere(type, page, limit);
    }
    //批量删除 JSON格式的数据请求
    @PostMapping("delbatch.do")
    public R del(@RequestBody int[] ids){
        return service.delBatch(ids);
    }
}
